<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>人物管理系统</title>
		<link th:href="@{/css/bootstrap.css}" rel="stylesheet" type="text/css" />
		<script type="text/javascript" th:src="@{/webjars/jquery/3.2.1/jquery.min.js}"></script>
		<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
		<script th:inline="javascript">
			$(function(){
				alertMSG();
			})
			function alertMSG(){
			    var msg = [[${MSG}]];
			    if(msg!=null){
			    	 alert(msg);
			    }
			}
        </script>
</head>
<body>
<div class="container-fluid">
	<div class="row">
		<div class="col-sm-12">
			<form class="form-horizontal" th:action="@{/user}" th:object="${user}" method="post">  	
		  		<input type="hidden" name="id" id="id" th:value="*{id}"/>	
		  		<input type="hidden" name="password2" id="password2" th:value="*{password2}"/>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">用户名(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
				      	<input type="text" id="username" name="username" th:value="*{username}" class="form-control"  maxlength="50"/>
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{username}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">密码(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
				      	<input class="form-control" type="password" id="password" name="password" th:value="*{password}" />
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{password}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">真实姓名(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
				      	<input class="form-control" type="text" id="truename" name="truename" th:value="*{truename}" />
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{truename}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">证件号码(<font color="red">*</font>):</label>
				    <div class="col-sm-6">
 			   			<input class="form-control" type="text" id="sfzh" name="sfzh" th:value="*{sfzh}" />
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{sfzh}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">单位信息:</label>
				    <div class="col-sm-6">
 			   			<textarea class="form-control" style="height:100px" id="department" name="department" maxlength="500" th:text="*{department}"></textarea>
			    	</div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">联系电话:</label>
				    <div class="col-sm-6">
 			   			<input class="form-control" type="text" id="telephone" name="telephone" th:value="*{telephone}" />
			    	</div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">邮箱:</label>
				    <div class="col-sm-6">
 			   			<input class="form-control" type="text" id="email" name="email" th:value="*{email}" />
			    	</div>
			    	<div class="col-sm-4" style="color:red"  th:errors="*{email}"></div>
		    	</div>
		  		<div class="form-group">
				    <label class="col-sm-2 control-label">角色:</label>
				    <div class="col-sm-6">
 			   			<span th:unless="${user.role!=null}" th:each="entity,iterStat:${roles}" >  
		   						<input type="checkbox" name="role" class="role" style="width:10px;" th:id="${entity.rolename}" th:value="${entity.rolename}"></input>
						   		 <label th:for="${entity.rolename}" th:text="${entity.memo}"></label>
						    </span> 
						    <span  th:if="${user.role!=null}" th:each="entity,iterStat:${roles}">  
		   						<input type="checkbox" name="role" class="role" style="width:10px;" th:id="${entity.rolename}" th:value="${entity.rolename}"
		   							 th:checked="${#lists.contains(user.role, entity.rolename)}"></input>
						   		 <label th:for="${entity.rolename}" th:text="${entity.memo}"></label>
					    </span>
			    	</div>
		    	</div>
			  	<div class="form-group" style="text-align:center">
				    <label class="col-sm-2 control-label"></label>
				    <div class="col-sm-6">
				   		<button type="submit" class="btn btn-success  btn-sm"  style="width:80px">确定</button> &nbsp; &nbsp;
						<button type="button" class="btn btn-default  btn-sm"  style="width:80px" onclick="history.go(-1)" >返回列表</button>
			    	</div>
		    	</div>
			</form>
		</div>
	</div>
</div>
</body>
</html>